/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
 */

/**
 * @version login.h 0.0.1
 * @author Dr.NP <np@bsgroup.org>
 * @package Comoro
 *
 * Login server header
 */

/* BEGIN OF CONSTANTS */
#define DEFAULT_LOGIN_SRV_PORT					65000
#define DEFAULT_LOGIN_SRV_STATUS_PORT			65100
#define MAX_USERNAME_LENGTH						64
#define MAX_PASSWORD_LENGTH						64
#define SESSION_KEY_LENGTH						64
#define MAX_LOGIN_BASE_SERVER					1024
/* END OF CONSTANTS */

/* BEGIN OF STRUCTS */
struct user_session
{
	int client_id;
	unsigned long long user_id;
	char username[MAX_USERNAME_LENGTH];
	char session_key[SESSION_KEY_LENGTH];
	int app_id;
};

struct base_info
{
	int base_id;
	unsigned long srv_addr;
	int srv_port;
	int num_clients;
};
/* END OF STRUCTS */

/* BEGIN OF FUNCTION DEFINE */
int login_init							();
void login_on_data						(int, void *, unsigned int);
void login_on_conn						(int);
void login_on_close						(int);
void login_on_status_data				(int, void *, unsigned int);
void login_on_status_reg					(int);
void login_on_status_unreg				(int);
int login_special_command				(int, unsigned int, unsigned int);
int login_do_login						(int, char *, char *, int);
int login_reg_base						(int, unsigned long, int);
/* END OF FUNCTION DEFINE */
